/********************************************************************
	file name:	hy_acceptor.h
	created:	2012/02/20 13:59
	author:		zxh
	
	purpose:	acceptor
*********************************************************************/
#ifndef _HY_ACCEPTOR_H_
#define _HY_ACCEPTOR_H_


#include "hy_handle_accept.h"

template<typename Tservice>
class hy_service_tactics : public hy_accept_tactics
{
public:
	hy_service_tactics(Tservice* service):_service(service)
	{

	}
	virtual ~hy_service_tactics(){}

	virtual hy_err_t handle_accept(hy_socket_t sc)
	{
		hy_assert(_service != NULL);
		if (_service != NULL)
		{
			_service->new_accept(sc);
			return hy_right;
		}
		return hy_error;
	}
private:
	Tservice*  _service;
};

class hy_acceptor : public hy_handle_accept
{
public:
	hy_acceptor():hy_handle_accept()
	{

	}

	~hy_acceptor(){}

};

#endif  //_HY_ACCEPTOR_H_
